<template>
  <div id="app">
    <Header ref="headerEle"/>
    <MyCount/>
    <button @click="getHeaderRef">点击获取Header组件上的ref</button>
  </div>
</template>

<script>
import Header from './components/Header'
import MyCount from './components/MyCount'

export default {
  name: 'App',
  components: {
    Header,
    MyCount
  },
  methods:{
    getHeaderRef(){
      // 如果ref属性写在一个组件上,那个$refs对象上保存的是组件实例
      console.log(this.$refs,'this.$refs');
      
      console.log(this.$refs.headerEle,'headerEle');
    }
  }
}
</script>

<style>
</style>
